package com.project.senven.commons.handler;

import com.project.senven.commons.uitl.JsonResult;
import com.project.senven.commons.uitl.ResultTool;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyException {

    //登录所有异常类的提示
    @ExceptionHandler(UserLoginException.class)
    public JsonResult userSaveException(Throwable e) {
        return ResultTool.fail(510, e.getMessage());
    }//登录所有异常类的提示
    @ExceptionHandler(UserAddException.class)
    public JsonResult userAddException(Throwable e) {
        return ResultTool.fail(511, e.getMessage());
    }
}
